package team.yidong.fenda.repository;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import team.yidong.fenda.entity.Hospital;
import team.yidong.fenda.entity.HospitalDepartment;

import java.util.List;

/**
 * Created by xuanlong on 2017/10/7.
 */
@Repository
public interface HospitalRepository extends JpaRepository<Hospital, Integer>, JpaSpecificationExecutor<Hospital> {
    Hospital findByName(String name);


    Hospital findByNameLike(String hospitalName);

    Hospital findByTixianTime(Integer tixianTime);

    @Query(value = "select distinct * from hospital  join hospital_department  where  hospital.id=hospital_department.hospital_id and hospital.id=2", nativeQuery = true)
    HospitalDepartment findSecondHospital();

}
